#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

typedef struct {
    int x;
    int y;
} point_t;

typedef struct {
    point_t p0;
    point_t p1;
    uint32_t color;
} line_t;

point_t new_point(int x, int y)
{
    static point_t po;
    po.x = x;
    po.y = y;
    return po;
}

line_t new_line(point_t p0, point_t p1, uint32_t color)
{
    line_t line;
    line.p0 = p0;
    line.p1 = p1;
    line.color = color;
    return line;
}

line_t print_line(line_t line)
{
    printf("line: (%d, %d), (%d, %d), color=%x\n",
           line.p0.x, line.p0.y, line.p1.x, line.p1.y,
           line.color);
    return line;
}

line_t move_line(line_t line, point_t p0, point_t p1)
{
    line.p0 = p0;
    line.p1 = p1;
    return line;
}

int main(int argc, char *argv[])
{
    line_t line =
                    print_line(
                move_line(
            print_line(
        new_line(
    new_point(100, 100), new_point(200, 200),0xaa55ff
        )
            ),
                new_point(200, 200),new_point(300, 400))
                    );

    print_line(line);

    line_t line2 =
    print_line(
        move_line(
            print_line(
                new_line(
                    new_point(200, 400), new_point(800, 600),0xff55aa
                )
            ),
        new_point(300, 300),new_point(600, 700)
        )
    );
    print_line(line2);

    return 0;
}
